{% extends "store/base.html" %}
{% block title %}
    天天生鲜
{% endblock %}

{% block content %}
      <!--添加商品按钮-->
    <div class="row">
        <button class="btn btn-primary col-lg-2 ml-auto" data-toggle="modal" data-target="#goods_modal">添加商品</button>
    </div>
    <h1></h1>
      <!--商品列表-->
    <div class="row">
      <table class="table">
          <thead>
            <tr>
                <th>商品编号</th>
                <th>商品名称</th>
                <th>商品类型</th>
                <th>商品价格</th>
                <th>商品数量</th>
            </tr>
          </thead>
          <tbody>
          {% for goods_obj in goods_list %}
              {% load myfilter %}
            <tr>
                        <td>{{ goods_obj.g_number }}</td>
                        <td>
                            <a href="#">{{ goods_obj.g_name }}</a>
                        </td>
                        <td>{{ goods_obj.g_type.t_name }}</td>
                        <td>{{ goods_obj.g_price | addcode }}</td>
                        <td>{{ goods_obj.g_num }}</td>
                    </tr>
          {% endfor %}
          </tbody>
      </table>
    </div>
    <h1></h1>
      <!--分页-->
    <div class="row">
        <ul class="pagination ml-auto">
            <li class="page-item">
                <a class="page-link">上一页</a>
            </li>
            <li class="page-item">
                <a class="page-link">1</a>
            </li>
            <li class="page-item">
                <a class="page-link">2</a>
            </li>
                                <li class="page-item">
                <a class="page-link">3</a>
            </li>
            <li class="page-item">
                <a class="page-link">4</a>
            </li>
            <li class="page-item">
                <a class="page-link">下一页</a>
            </li>
        </ul>
    </div>
    <div class="modal fade" id="goods_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-label="true">
      <div class="modal-dialog" role="document">
          <div class="modal-content">
              <div class="modal-header">添加商品</div>
              <div class="modal-body">
                  <form class="form" method="post" enctype="multipart/form-data">
                      {% csrf_token %}
                      <div class="form-group">
                        <label class="">商品名称</label>
                        <input class="form-control" type="text" name="goods_name">
                      </div>
                      <div class="form-group">
                        <label class="">商品类型</label>
                        <select class="form-control" name="goods_type">
                            <option>--商品类型--</option>
                            {% for one in goods_type %}
                                <option value="{{ one.id }}">{{ one.t_name }}</option>
                            {% endfor %}

                        </select>
                      </div>

                      <div class="form-group">
                        <label class="">商品价格</label>
                        <input class="form-control" type="text" name="g_price">
                      </div>
                      <div class="form-group">
                        <label class="">商品保质期</label>
                        <input class="form-control" type="text" name="g_safe_date">
                      </div>
                      <div class="form-group">
                        <label class="">商品出场日期</label>
                        <input class="form-control" type="text" name="g_public_date">
                      </div>
                      <div class="form-group">
                        <label class="">商品数量</label>
                        <input class="form-control" type="text" name="goods_number">
                      </div>
                      <div class="form-group">
                        <label class="">商品描述</label>
                        <textarea class="form-control" name="g_description"></textarea>
                      </div>
                      <div class="form-group">
                        <label class="">商品图片</label>
                        <input class="form-control" type="file" name="g_picture">
                      </div>
                      <button class="btn btn-primary fa-pull-right" type="submit">提交商品</button>
                  </form>
              </div>
          </div>
      </div>
  </div>
{% endblock %}



